{% extends "layout.njk" %}

{# 设置标题 #}
{% block title %}
    详情
{% endblock %}

{# 设置样式 #}
{% block css %}
    {{super()}}
{% endblock %}

{# 设置脚本 #}
{% block js %}
    {{super()}}
{% endblock %}

{# 设置主区域 #}
{% block main %}
    <div class="container">
        <div class="topic-detail">
            <div class="title">{{t.title}}</div>
            <div class="author">
                {{t.author}} 发布于 {{t.time|dateformat}}
            </div>
            <hr>
            <div class="content">{{t.content|safe}}</div>
        </div>
        {% if c %}
        <div class="comment-form">
            <form action="/comment/publish" method="post">
                <input type="hidden" name="topicId" value="{{t.id}}">
                <textarea name="content" ></textarea>
                <button type="submit">评论</button>
            </form>
        </div>
        {% endif %}
        {% if comments %}
        <div class="comment-list">
            {% for c in comments %}
            <div class="comment-item">
                <div>{{c.content}}</div>
                <p>{{c.author}}评论于{{c.time|dateformat}}</p>
            </div>
            {% endfor%}
        </div>
        {% endif %}
    </div>
{% endblock %}